package FPGrowth;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
import java.util.StringTokenizer;

public class ReadFile {

	public static void main(String[] args) {
		
		
		File file = new File("text1");
		BufferedReader reader = null;
		Scanner input = null;
		short[][] data = null;
		
		try {
			reader = new BufferedReader(new FileReader(file));
		} catch (FileNotFoundException e1) {
			// TODO Auto-generated catch block
			e1.printStackTrace();
		}
	
		try {
			String current;
			current = reader.readLine();
			data = new short[6][];
			int row =0;
			while(current != null ) {
				/*
				input = new Scanner(current);
				while(input.hasNext()) {
					System.out.print(input.nextInt()+"_");
				}
				*/
				StringTokenizer line = new StringTokenizer(current);
				int col =0;
				data[row] = new short[line.countTokens()];
				while (line.hasMoreElements()) {
					data[row][col] = Short.parseShort(line.nextElement().toString());
					//System.out.print(line.nextElement()+"_");
					col++;
				}
				//System.out.println();
				row++;
				current = reader.readLine();
			}
		} catch (IOException e) {
			
			e.printStackTrace();
		}
		
		/*
		List<Short> itemList1 = new ArrayList<Short>();
		itemList1.add((short)1);
		itemList1.add((short)2);
		itemList1.add((short)3);
		Short[] k= new Short[itemList1.size()];
		itemList1.toArray(k);

		System.out.println(k[0]);
		*/
		for(int i =0; i<data.length; i++) {
			for(int j =0;j<data[i].length;j++)
				System.out.print(data[i][j]+"_");
			System.out.println();
		}
		
		System.out.println(data.length);
	}

}
